<?php

namespace App\Models\Attendance;

use Jenssegers\Mongodb\Eloquent\Model;

/**
 * 考勤报表数据模型
 *
 * Date: 30/04/2018
 * @author George
 * @package App\Models\Attendance
 */
class Report extends Model
{
	/**
	 * 定义数据库连接
	 *
	 * @var string
	 * Date: 30/04/2018
	 * @author George
	 */
	protected $connection = 'mongodb';

	/**
	 * 定义集合名称
	 *
	 * @var string
	 * Date: 30/04/2018
	 * @author George
	 */
	protected $collection = 'attendance';

	/**
	 * 定义不可填充字段
	 *
	 * @var array
	 * Date: 30/04/2018
	 * @author George
	 */
	protected $guarded = [''];

	/**
	 * Report constructor.
	 * @param array $attributes
	 */
	public function __construct(array $attributes = [])
	{
		$this->collection = date('Y-m', strtotime('-' . (config('system.report.delay') + 1) . ' day'));
		parent::__construct($attributes);
	}
}
